package io.renren.modules.avanotes.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.renren.modules.avanotes.entity.FormworkEntity;
import io.renren.modules.avanotes.entity.LocalMarkdownNotesEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * 本地笔记表
 *
 * @author zzr
 * @email 529742454@qq.com
 * @date 2022-01-24 22:50:09
 */
@Mapper
public interface LocalMarkdownNotesDao extends BaseMapper<LocalMarkdownNotesEntity> {

    @Update("update local_markdown_notes set status=#{status} where id=#{id}")
    int updateStatus(@Param("id") long id, @Param("status") int status);

    /**
     * 使用正则分页查询正文
     */
    IPage<LocalMarkdownNotesEntity> findPageByRegex(IPage<LocalMarkdownNotesEntity> page, @Param("regex") String regex);

    /**
     * insert ignore
     * @param entity
     */
    void insertIgnore(@Param("entity") LocalMarkdownNotesEntity entity);

    /**
     * replace into
     * @param entity
     */
    void insertUpdate(@Param("entity") LocalMarkdownNotesEntity entity);

}
